package com.edu.imau.ManageUserInformation;

import com.edu.imau.ParkingDao;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/update")
public class UserUpdateServlet extends HttpServlet {
    private ParkingDao dao =new ParkingDao();
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        //1：接收请求 处理参数
        String id_str = request.getParameter("id");
        //2:调用model
        if(id_str != null){
            User user = dao.getUserById(Integer.parseInt(id_str));
            //3:展示view
            request.setAttribute("user",user);
            request.getRequestDispatcher("user.jsp").forward(request,response);
        }

    }
}
